fix: CREATE ODATA CLIENT strips uppercase MICROFLOW keyword prefix (#573)#586
Conversation
Closes #573. Visitor emits "MICROFLOW Module.Name" (uppercase) for `microflow X.Y` property values, but extractMicroflowRef only stripped lowercase "microflow ", so the prefix survived into BSON. Mendix then tried to resolve a microflow whose qualified name was literally "MICROFLOW Module.Name" and failed — matching the user-reported error. Fix is a case-insensitive prefix strip in extractMicroflowRef. Same code path serves CREATE, CREATE OR MODIFY, and ALTER ODATA CLIENT. Tests: - TestCreateODataClient_StripsMicroflowPrefix_Issue573 — direct executor test against the proximate failure point. - TestCreateODataClient_VisitorRoundtrip_Issue573 — full MDL → visitor → executor pipeline with the user's exact syntax. - mdl-examples/bug-tests/573-odata-microflow-prefix.mdl — reproduction script for Studio Pro validation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove. The PR correctly fixes the issue with comprehensive test coverage, minimal code changes, and appropriate documentation updates. No changes needed. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove. The PR correctly fixes the bug with minimal, focused changes, includes appropriate test coverage at multiple levels, updates preventive documentation, and maintains all project quality standards. The fix resolves the exact issue where Mendix was trying to resolve microflows with literal "MICROFLOW " prefixes in their names. All checks pass and the solution aligns with the project's architecture and contribution guidelines. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
Follow-up to #573. The case-strip fix landed in PR #586 was necessary but insufficient — even with the prefix stripped, mxcli wrote to BSON keys that Studio Pro (≥ 11.10) no longer recognizes, so the "Configuration source" dropdown still defaulted to "Constants only" and the microflow was silently unused. Investigation by diffing test6.mpr Studio Pro-saved samples against mxcli output revealed: - "Configuration microflow" BSON key was renamed ConfigurationMicroflow → ConfigurationEntityMicroflow - The dropdown's third state "Headers microflow" maps to a separate BSON key HeaderListMicroflow that mxcli didn't write at all - No discriminator field — the three dropdown states correspond to (both empty) / (Configuration set) / (Headers set), mutually exclusive The MDL property name ConfigurationMicroflow is kept for backwards compatibility; the new option is exposed as MDL property HeadersMicroflow. Internal Go field names match the MDL property names; the BSON storage names are translated only in the writer/parser pair, with comments documenting the mapping. Tests: - sdk/mpr/writer_odata_test.go asserts the new BSON keys and explicitly rejects the legacy ConfigurationMicroflow key (which Studio Pro would silently ignore). - mdl/executor/cmd_odata_mock_test.go adds TestCreateODataClient_HeadersMicroflow covering the full MDL → visitor → executor → captured value pipeline. - mdl-examples/bug-tests/573-odata-microflow-prefix.mdl exercises both ConfigurationMicroflow and HeadersMicroflow clients end-to-end for Studio Pro validation. - mdl-examples/doctype-tests/10-odata-examples.mdl gains an OdTest.HeadersConfigAPI example alongside FullConfigAPI. A new symptom-table row in .claude/skills/fix-issue.md captures the broader class — "Studio Pro shows default value despite explicit MDL" — so the next silently-renamed BSON key gets caught faster. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fixes #573.
Summary
extractMicroflowRefnow strips themicroflowkeyword prefix case-insensitively. The visitor atmdl/visitor/visitor_odata.go:269emits uppercase"MICROFLOW " + qnformicroflow Module.Nameproperty values, but the executor was only trimming lowercase, so the keyword survived into BSON. Mendix then tried to resolve a microflow whose qualified name was literally"MICROFLOW Module.Name"and failed — exactly the error in the issue screenshot..claude/skills/fix-issue.mdso the next visitor-emits-uppercase-but-executor-strips-lowercase mismatch gets caught immediately.Scope
The same
extractMicroflowRefhelper serves three OData-client codepaths:CREATE ODATA CLIENT(cmd_odata.go:1001-1002)CREATE OR MODIFY ODATA CLIENTupdate path (cmd_odata.go:913, 916)ALTER ODATA CLIENT SET …(cmd_odata.go:1152, 1154)All three are fixed by the one-line change.
Test plan
TestCreateODataClient_StripsMicroflowPrefix_Issue573— direct executor test against the proximate failure point.TestCreateODataClient_VisitorRoundtrip_Issue573— full MDL → visitor → executor pipeline using the user's exact syntax.main, pass with this change.mdl-examples/bug-tests/573-odata-microflow-prefix.mdl— reproduction script that passesmxcli check; ready to run throughmxcli execagainst a real project and Studio Pro for confirmation.make testpasses.make lintpasses.🤖 Generated with Claude Code